// import {$http } from "@escook/request-miniprogram";

// api地址
const api = {

	list: '/addressbook/getAddressBookList',
	add: '/addressbook/addAddressBook',
	delete: '/addressbook/deleteAddressBook',
	update: '/addressbook/updateAddressBook',
	selById: '/addressbook/getAddressBookById'

}


// 请求地址列表  
export const getAddressList = () => {
	return uni.$http.get(api.list);
}

// 增加  
export const addAddress = (addAddressBookDto) => {
	// 使用POST请求进行添加操作  
	return uni.$http.post(api.add, addAddressBookDto);
}

// 删除  
export const deleteAddress = (addressBookId) => {
	// 使用DELETE请求进行删除操作，并将ID放在URL路径中  
	return uni.$http.get(`${api.delete}/${addressBookId}`);
}

// 更新  

export const updateAddress = (addressData) => {  
  return uni.$http.post(api.update, addressData);  
}

//根据id查地址
export const selectAddress = (addressBookId) => {
	return uni.$http.get(`${api.selById}/${addressBookId}`)
}